package labox.innovation.gameserver.skills.conditions;

import labox.innovation.gameserver.model.actor.L2Attackable;
import labox.innovation.gameserver.model.actor.L2Npc;
import labox.innovation.gameserver.skills.Env;

public class ConditionTargetNpcId extends Condition {

	private final String[] _npcIds;

	public ConditionTargetNpcId(String[] ids) {
		_npcIds = ids;
	}

	@Override
	public boolean testImpl(Env env) {
		if (env.target == null)
			return false;
		boolean mt;
		for (int i = 0; i < _npcIds.length; i++) {
			mt = (((env.target instanceof L2Attackable) && ((L2Attackable) env.target).getNpcId() == Integer.parseInt(_npcIds[i])) || ((env.target instanceof L2Npc) && ((L2Npc) env.target).getNpcId() == Integer.parseInt(_npcIds[i])));
			if (mt)
				return true;
		}
		return false;
	}
}
